<template>
  <div>
    <el-table
        :data="getProjectAccount"
        style="width: 100%">
        <el-table-column
        prop="accountName"
        label="员工姓名">

        </el-table-column>
        <el-table-column
        prop="roleName"
        label="职位">

        </el-table-column>

        </el-table>

        <el-pagination
               fixed
               @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
               :current-page="pages.current"
               :page-sizes="[1, 2, 3, 4]"
               :page-size="pages.size"
               layout="total, sizes, prev, pager, next, jumper"
               :total="pages.total">
             </el-pagination>
  </div>
</template>

<script>
  export default{
    name:"projectaccount",
    data(){
      return{
        getProjectAccount:[],
        pages:{}
      }
    },
    methods:{
      getAccountByProject(current,size){
        let pid=localStorage.getItem("projectId")
        this.$http.get("accountRoleProject/getProjectAccount",{
          params:{
            "projectId":pid,
            "current":current,
            "size":size
          }
        }).then(resp=>{
          this.getProjectAccount=resp.data.data.records
          this.pages=resp.data.data
        })
      },

      handleSizeChange(val){

        this.pages.size=val
        this.getAccountByProject(this.pages.num,val)
      },
      handleCurrentChange(val){
        this.pages.current=val
        this.getAccountByProject(val,this.pages.size)
      }
    },
    created() {
      this.getAccountByProject(1,2)
    }
  }
</script>

<style>
</style>
